// 提现模块公用方法
import {mapGetters} from 'vuex'
import {customRequest,getDetail} from "../api/crud";
const pay = {
  data() {
    return {
      type:'',
			balance:0,
      apiModule:"shopApi",
      apiType:'userAccountSetting',
			isPaymentPsd:0
    };
  },
  onLoad(option) {
    this.type = option.type
  },
  computed:{
    ...mapGetters(['loginForm']),
    payType(){
      if(this.type == 1) return 'zhifubao'
      if(this.type == 2) return 'weixin'
      if(this.type == 3) return 'bank'
    },
  },
  methods: {
    // 查看账户列表
    payUserList(){
      return customRequest({
				uid:this.loginForm.uid,
				type:this.payType
			},this.apiType,this.apiModule,'list','get').then(res=>{
        this.payList = res
      })
    },
		getBalance(){
			//获取用户余额
			getDetail('','user','shopApi','getUserBalance').then(res=>{
				this.balance = res.balance
				this.isPaymentPsd = res.isPaymentPsd
			})
		}
  }

}
export default pay